/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.edu.unal.behaviours;

import co.edu.unal.inventory.Stock;
import jade.core.behaviours.Behaviour;
import javax.swing.JList;
import javax.swing.JTextArea;

/**
 *
 * @author raider
 */
public class CreateStock extends Behaviour {

    private Stock inventario;
    private int size = 0;
    int qOpt;/*Tamaño lote*/
    int d_anual;/*demanda anual*/
    int lT;/*tiempo reabastecimiento*/
    int iS;/*Tamaño invet. seguridad*/
    JTextArea log;

    public CreateStock(Stock inventario, JTextArea log) {
        this.inventario = inventario;
        this.log = log;
    }

    @Override
    public void action() {
        size+=10;
        inventario.calcularInventario(size, inventario.getDemandaAnual(), inventario.getlT(), inventario.getInventarioSeguridad());
        //log.setText(log.getText()+ "\n" +"Ajustando tamaño inventario a "+size);
    }

    @Override
    public boolean done() {
        boolean valido = inventario.validaInventario();
        if(valido==true){
            log.setText(log.getText()+ "\n" +"Tamaño maximo Inventario "+inventario.getInventarioMaximo() +", Punto de pedido "+inventario.getPuntoPedido());
            return true;
        }        
        return false;
    }
}